/**
 * file :	wa_exception.cpp
 * author :	bushaofeng
 * created :	2013-03-23 23:46
 * func : 
 */

#include "wa_exception.h"

const static char* _err_dup_map[WA_ERR_NUM] = {
    "重复",
    WA_ERR_USER_DUP,
    WA_ERR_PROJ_DUP
};

const static char* _err_none_map[WA_ERR_NUM] = {
    "不存在",
    WA_ERR_USER_NOTFOUND,
    WA_ERR_PROJ_NOTFOUND,
    WA_ERR_FIELD_NOTFOUND
};

const char* WAException::getMongoError(int type, int code){
    switch(code){
        case 11000:
            return _err_dup_map[type];
        case 13111:
            return _err_none_map[type];
        default:
            return WA_ERR_DEFAULT;
    }
    return NULL;
}
